package com.evl.trainSeat.warpper;

import java.util.Map;

import com.evl.common.persistence.dao.VehicleMapper;
import com.evl.common.persistence.model.Vehicle;
import com.evl.common.warpper.BaseControllerWarpper;
import com.evl.constant.TrainSeatType;
import com.evl.core.util.SpringContextHolder;

/**
 * 座位列表的包装
 *
 * @author fengshuonan
 * @date 2017年4月25日 18:10:31
 */
public class TrainSeatWarpper extends BaseControllerWarpper {

	private VehicleMapper vehicleMapper = SpringContextHolder.getBean(VehicleMapper.class);
	
    public TrainSeatWarpper(Object list) {
        super(list);
    }

    @Override
    public void warpTheMap(Map<String, Object> map) {
    	map.put("seatType", TrainSeatType.valueOf(Integer.parseInt(map.get("seatType").toString())));
    	map.put("vehicleNo", findVehicleNo(map.get("vehicleId")));
    }
    
    public String findVehicleNo(Object vehicleId){
    	Vehicle vehicle = this.vehicleMapper.selectById(String.valueOf(vehicleId));
    	return vehicle.getVehicleNo();
    }

}
